import { chromium } from "playwright";

// use connectOverCDP to pass the Lightpanda's CDP server address.
const browser = await chromium.connectOverCDP("ws://127.0.0.1:9222");

// The rest of your script remains the same.
const context = await browser.newContext({});
const page = await context.newPage();

const urls = [
  "https://moredoc.mnt.ltd/document/bf836a681dd87f58",
  "https://moredoc.mnt.ltd/document/5dbe8a07a6675208",
  "https://moredoc.mnt.ltd/document/e7c7c41499f84f2e",
  "https://moredoc.mnt.ltd/document/3174326888cabff8",
  "https://moredoc.mnt.ltd/document/902ae97576d006ff",
];

const start = Date.now();
await page.goto("https://moredoc.mnt.ltd/document/902ae97576d006ff");
await page.waitForLoadState("networkidle");
const content = await page.content();
console.log(`Page loaded in ${Date.now() - start}ms`);
console.log(content);

await page.close();
await context.close();
await browser.close();
